1. Technical Field
Present invention embodiments relate to databases, and more specifically, to join order.
2. Discussion of the Related Art
When executing a join in a database system, such as a join for a query, a query plan is constructed by a query optimizer. The performance of a query plan is determined largely by the order in which the tables are joined. For example, when joining three tables A, B and C of size 10 rows, 10,000 rows, and 1,000,000 rows, respectively, a query plan that joins B and C first can take several orders-of-magnitude more time to execute than one that joins A and C first.
Choosing the best join order for a query is non-trivial and challenging especially due to the absence of table statistics or staleness of statistics. Even with the latest and most thoroughly collected statistics, join order selection tray rely on cardinality and correlation estimates that can be imperfect.